<script src="/static/socket.io-1.4.4.js"></script>
<body>
    <button onclick="send()">发射</button>
</body>
<script>
    const socket = io('http://127.0.0.1:8080');

    // 连接成功后
    socket.on('connect', () => {
        console.log('连接成功'); // 'G5p5...'
    });

    function send() {
        socket.emit('Message','6666')
    }

    // 此处监听服务端emit的事件名称
    socket.on('test', function (data) {

        console.log(data)
    })
</script>